.class public Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;
.super Lcom/nemustech/regina/ElementReginaWidget;
.source "AppManagerWidget.java"


# static fields
.field private static final APP_MANAGER_MORPH_TIME:I = 0xc8

.field private static final APP_MANAGER_WIDGET_TITLE:Ljava/lang/String; = "App Manager"

.field private static final APP_MANAGER_WIDGET_TITLE_INCLUDE_MEMINFO:Ljava/lang/String; = "App Manager - %dM libres"

.field private static final TAG:Ljava/lang/String; = "AppManagerWidget"

.field public static final WIDGET_DISPLAY_STATE_EXTEND:I = 0x1

.field public static final WIDGET_DISPLAY_STATE_FOLD:I


# instance fields
.field mAppFilter:Lcom/nemustech/regina/ReginaAppFilter;

.field mAppRIList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Landroid/content/pm/ResolveInfo;",
            ">;"
        }
    .end annotation
.end field

.field mFreeMem:I

.field mPkgMgr:Landroid/content/pm/PackageManager;

.field mRunningAppList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Landroid/content/pm/ApplicationInfo;",
            ">;"
        }
    .end annotation
.end field

.field mWidget3DYBeforeMorph:F

.field mWidgetDisplayState:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 5
    .parameter "context"

    .prologue
    const/4 v3, 0x1

    .line 52
    invoke-direct {p0, p1, v3}, Lcom/nemustech/regina/ElementReginaWidget;-><init>(Landroid/content/Context;Z)V

    .line 53
    iget-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    iput-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mPkgMgr:Landroid/content/pm/PackageManager;

    .line 54
    new-instance v1, Lcom/nemustech/regina/ReginaAppFilter;

    invoke-direct {v1, p1}, Lcom/nemustech/regina/ReginaAppFilter;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppFilter:Lcom/nemustech/regina/ReginaAppFilter;

    .line 55
    iget-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppFilter:Lcom/nemustech/regina/ReginaAppFilter;

    const/4 v2, 0x4

    invoke-virtual {v1, v2, v3}, Lcom/nemustech/regina/ReginaAppFilter;->getInstalledApps(IZ)Ljava/util/List;

    move-result-object v1

    iput-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    .line 57
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.intent.action.MAIN"

    const/4 v2, 0x0

    invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .line 58
    .local v0, mainIntent:Landroid/content/Intent;
    const-string v1, "android.intent.category.LAUNCHER"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 59
    iget-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v0, v2}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v1

    iput-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppRIList:Ljava/util/List;

    .line 60
    invoke-direct {p0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->getMemoryInfo()Landroid/app/ActivityManager$MemoryInfo;

    move-result-object v1

    iget-wide v1, v1, Landroid/app/ActivityManager$MemoryInfo;->availMem:J

    const-wide/32 v3, 0x100000

    div-long/2addr v1, v3

    long-to-int v1, v1

    iput v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mFreeMem:I

    .line 61
    return-void
.end method

.method private getAppLabel(Landroid/content/pm/ApplicationInfo;)Ljava/lang/String;
    .locals 1
    .parameter "appInfo"

    .prologue
    .line 169
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mPkgMgr:Landroid/content/pm/PackageManager;

    invoke-virtual {p1, v0}, Landroid/content/pm/ApplicationInfo;->loadLabel(Landroid/content/pm/PackageManager;)Ljava/lang/CharSequence;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private getClassNameFromResolveInfo(Ljava/lang/String;)Ljava/lang/String;
    .locals 4
    .parameter "pkgName"

    .prologue
    .line 275
    const/4 v1, 0x0

    .line 277
    .local v1, rInfo:Landroid/content/pm/ResolveInfo;
    iget-object v3, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppRIList:Ljava/util/List;

    invoke-interface {v3}, Ljava/util/List;->size()I

    move-result v2

    .line 278
    .local v2, size:I
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, v2, :cond_1

    .line 279
    iget-object v3, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppRIList:Ljava/util/List;

    invoke-interface {v3, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    .end local v1           #rInfo:Landroid/content/pm/ResolveInfo;
    check-cast v1, Landroid/content/pm/ResolveInfo;

    .line 280
    .restart local v1       #rInfo:Landroid/content/pm/ResolveInfo;
    iget-object v3, v1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v3, v3, Landroid/content/pm/ActivityInfo;->packageName:Ljava/lang/String;

    invoke-virtual {p1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_0

    .line 281
    iget-object v3, v1, Landroid/content/pm/ResolveInfo;->activityInfo:Landroid/content/pm/ActivityInfo;

    iget-object v3, v3, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    .line 285
    :goto_1
    return-object v3

    .line 278
    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 285
    :cond_1
    const/4 v3, 0x0

    goto :goto_1
.end method

.method private getDrawableToBitmap(IILandroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;
    .locals 4
    .parameter "width"
    .parameter "height"
    .parameter "drawable"

    .prologue
    const/4 v3, 0x0

    .line 159
    sget-object v2, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    invoke-static {p1, p2, v2}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 161
    .local v0, bitmap:Landroid/graphics/Bitmap;
    new-instance v1, Landroid/graphics/Canvas;

    invoke-direct {v1, v0}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 162
    .local v1, canvas:Landroid/graphics/Canvas;
    invoke-virtual {p3, v3, v3, p1, p2}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 163
    invoke-virtual {p3, v1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 165
    return-object v0
.end method

.method private getEllipsisString(Landroid/graphics/Paint;Ljava/lang/String;F)Ljava/lang/String;
    .locals 7
    .parameter "paint"
    .parameter "str"
    .parameter "maxWidth"

    .prologue
    const/4 v6, 0x0

    .line 262
    new-instance v1, Landroid/graphics/Rect;

    invoke-direct {v1}, Landroid/graphics/Rect;-><init>()V

    .line 263
    .local v1, bound:Landroid/graphics/Rect;
    const-string v0, ".."

    .line 264
    .local v0, ELLIPSIS:Ljava/lang/String;
    const-string v3, ".."

    const/4 v4, 0x2

    invoke-virtual {p1, v3, v6, v4, v1}, Landroid/graphics/Paint;->getTextBounds(Ljava/lang/String;IILandroid/graphics/Rect;)V

    .line 266
    const/4 v3, 0x1

    invoke-virtual {v1}, Landroid/graphics/Rect;->width()I

    move-result v4

    int-to-float v4, v4

    sub-float v4, p3, v4

    const/4 v5, 0x0

    invoke-virtual {p1, p2, v3, v4, v5}, Landroid/graphics/Paint;->breakText(Ljava/lang/String;ZF[F)I

    move-result v2

    .line 268
    .local v2, filteredLen:I
    invoke-virtual {p2}, Ljava/lang/String;->length()I

    move-result v3

    if-eq v2, v3, :cond_0

    .line 269
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p2, v6, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, ".."

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    .line 271
    :goto_0
    return-object v3

    :cond_0
    move-object v3, p2

    goto :goto_0
.end method

.method private getMemoryInfo()Landroid/app/ActivityManager$MemoryInfo;
    .locals 4

    .prologue
    .line 252
    iget-object v2, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mContext:Landroid/content/Context;

    const-string v3, "activity"

    invoke-virtual {v2, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    .line 253
    .local v0, activityManager:Landroid/app/ActivityManager;
    new-instance v1, Landroid/app/ActivityManager$MemoryInfo;

    invoke-direct {v1}, Landroid/app/ActivityManager$MemoryInfo;-><init>()V

    .line 254
    .local v1, memoryInfo:Landroid/app/ActivityManager$MemoryInfo;
    invoke-virtual {v0, v1}, Landroid/app/ActivityManager;->getMemoryInfo(Landroid/app/ActivityManager$MemoryInfo;)V

    .line 258
    return-object v1
.end method


# virtual methods
.method protected hasBack()Z
    .locals 1

    .prologue
    .line 290
    const/4 v0, 0x1

    return v0
.end method

.method protected onCreate()V
    .locals 2

    .prologue
    .line 65
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->createWidget(I)V

    .line 67
    invoke-super {p0}, Lcom/nemustech/regina/ElementReginaWidget;->getTitlePanel()Lcom/nemustech/tiffany/world/TFPanel;

    move-result-object v0

    const-string v1, "App Manager Widget Title Panel"

    iput-object v1, v0, Lcom/nemustech/tiffany/world/TFPanel;->mDescription:Ljava/lang/String;

    .line 68
    invoke-super {p0}, Lcom/nemustech/regina/ElementReginaWidget;->getCenterPanel()Lcom/nemustech/tiffany/world/TFPanel;

    move-result-object v0

    const-string v1, "App Manager Widget Center Panel"

    iput-object v1, v0, Lcom/nemustech/tiffany/world/TFPanel;->mDescription:Ljava/lang/String;

    .line 69
    invoke-super {p0}, Lcom/nemustech/regina/ElementReginaWidget;->getBottomPanel()Lcom/nemustech/tiffany/world/TFPanel;

    move-result-object v0

    const-string v1, "App Manager Widget Bottom Panel"

    iput-object v1, v0, Lcom/nemustech/tiffany/world/TFPanel;->mDescription:Ljava/lang/String;

    .line 70
    invoke-super {p0}, Lcom/nemustech/regina/ElementReginaWidget;->getFrontCenterItemPanel()Lcom/nemustech/tiffany/world/TFPanel;

    move-result-object v0

    const-string v1, "App Manager Widget Center Item Panel"

    iput-object v1, v0, Lcom/nemustech/tiffany/world/TFPanel;->mDescription:Ljava/lang/String;

    .line 71
    return-void
.end method

.method protected onDrawBackItem(Landroid/graphics/Bitmap;Landroid/graphics/Rect;I)V
    .locals 0
    .parameter "bitmap"
    .parameter "area"
    .parameter "index"

    .prologue
    .line 300
    return-void
.end method

.method protected onDrawBackTitle(Landroid/graphics/Bitmap;Landroid/graphics/Rect;)V
    .locals 1
    .parameter "bitmap"
    .parameter "area"

    .prologue
    .line 295
    const-string v0, "App Manager Settings"

    invoke-virtual {p0, p1, p2, v0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->drawTitle(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Ljava/lang/String;)V

    .line 296
    return-void
.end method

.method protected onDrawFrontItem(Landroid/graphics/Bitmap;Landroid/graphics/Rect;I)V
    .locals 28
    .parameter "bitmap"
    .parameter "area"
    .parameter "index"

    .prologue
    .line 75
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    move-object/from16 v23, v0

    if-eqz v23, :cond_0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    move-object/from16 v23, v0

    invoke-interface/range {v23 .. v23}, Ljava/util/List;->size()I

    move-result v23

    move/from16 v0, p3

    move/from16 v1, v23

    if-lt v0, v1, :cond_1

    .line 156
    :cond_0
    :goto_0
    return-void

    .line 77
    :cond_1
    new-instance v12, Landroid/graphics/Canvas;

    move-object v0, v12

    move-object/from16 v1, p1

    invoke-direct {v0, v1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 78
    .local v12, canvas:Landroid/graphics/Canvas;
    new-instance v19, Landroid/graphics/Paint;

    invoke-direct/range {v19 .. v19}, Landroid/graphics/Paint;-><init>()V

    .line 79
    .local v19, paint:Landroid/graphics/Paint;
    new-instance v11, Landroid/graphics/Rect;

    invoke-direct {v11}, Landroid/graphics/Rect;-><init>()V

    .line 81
    .local v11, boundsLabel:Landroid/graphics/Rect;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    move-object/from16 v23, v0

    const v24, 0x7f060048

    invoke-virtual/range {v23 .. v24}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v22

    .line 82
    .local v22, vMargin:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    move-object/from16 v23, v0

    const v24, 0x7f060049

    invoke-virtual/range {v23 .. v24}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v14

    .line 83
    .local v14, hMargin:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    move-object/from16 v23, v0

    const v24, 0x7f060057

    invoke-virtual/range {v23 .. v24}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v15

    .line 84
    .local v15, iconSize:I
    invoke-virtual/range {p2 .. p2}, Landroid/graphics/Rect;->height()I

    move-result v20

    .line 85
    .local v20, rowHeight:I
    invoke-virtual/range {p2 .. p2}, Landroid/graphics/Rect;->width()I

    move-result v21

    .line 86
    .local v21, rowWidth:I
    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->bottom:I

    move/from16 v23, v0

    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->top:I

    move/from16 v24, v0

    sub-int v23, v23, v24

    div-int/lit8 v23, v23, 0x2

    move/from16 v0, v23

    int-to-float v0, v0

    move v10, v0

    .line 88
    .local v10, areaHalfLength:F
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    move-object/from16 v23, v0

    move-object/from16 v0, v23

    move/from16 v1, p3

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Landroid/content/pm/ApplicationInfo;

    .line 89
    .local v7, appInfo:Landroid/content/pm/ApplicationInfo;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mPkgMgr:Landroid/content/pm/PackageManager;

    move-object/from16 v23, v0

    move-object v0, v7

    move-object/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/content/pm/ApplicationInfo;->loadIcon(Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;

    move-result-object v23

    move-object/from16 v0, p0

    move v1, v15

    move v2, v15

    move-object/from16 v3, v23

    invoke-direct {v0, v1, v2, v3}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->getDrawableToBitmap(IILandroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;

    move-result-object v6

    .line 90
    .local v6, appIcon:Landroid/graphics/Bitmap;
    move-object/from16 v0, p0

    move-object v1, v7

    invoke-direct {v0, v1}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->getAppLabel(Landroid/content/pm/ApplicationInfo;)Ljava/lang/String;

    move-result-object v8

    .line 92
    .local v8, appLabel:Ljava/lang/String;
    const/16 v23, 0x1

    move-object/from16 v0, v19

    move/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 93
    sget-object v23, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    move-object/from16 v0, v19

    move-object/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 94
    const/high16 v23, 0x3f00

    const/high16 v24, 0x3f80

    const/high16 v25, 0x3f80

    const/high16 v26, -0x100

    move-object/from16 v0, v19

    move/from16 v1, v23

    move/from16 v2, v24

    move/from16 v3, v25

    move/from16 v4, v26

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Paint;->setShadowLayer(FFFI)V

    .line 96
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    move-object/from16 v23, v0

    const v24, 0x7f060056

    invoke-virtual/range {v23 .. v24}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v23

    move/from16 v0, v23

    int-to-float v0, v0

    move/from16 v23, v0

    move-object/from16 v0, v19

    move/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 97
    mul-int/lit8 v23, v14, 0x2

    sub-int v23, v21, v23

    move/from16 v0, v23

    int-to-float v0, v0

    move/from16 v23, v0

    move-object/from16 v0, p0

    move-object/from16 v1, v19

    move-object v2, v8

    move/from16 v3, v23

    invoke-direct {v0, v1, v2, v3}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->getEllipsisString(Landroid/graphics/Paint;Ljava/lang/String;F)Ljava/lang/String;

    move-result-object v9

    .line 98
    .local v9, appLabelSeq:Ljava/lang/CharSequence;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    move-object/from16 v23, v0

    const v24, 0x7f060056

    invoke-virtual/range {v23 .. v24}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v23

    move/from16 v0, v23

    int-to-float v0, v0

    move/from16 v23, v0

    move-object/from16 v0, v19

    move/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 99
    invoke-virtual {v9}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v23

    const/16 v24, 0x0

    invoke-interface {v9}, Ljava/lang/CharSequence;->length()I

    move-result v25

    move-object/from16 v0, v19

    move-object/from16 v1, v23

    move/from16 v2, v24

    move/from16 v3, v25

    move-object v4, v11

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Paint;->getTextBounds(Ljava/lang/String;IILandroid/graphics/Rect;)V

    .line 101
    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->top:I

    move/from16 v23, v0

    add-int v23, v23, v22

    move/from16 v0, v23

    int-to-float v0, v0

    move/from16 v16, v0

    .line 102
    .local v16, iconY:F
    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->top:I

    move/from16 v23, v0

    add-int v23, v23, v22

    move/from16 v0, v23

    int-to-float v0, v0

    move/from16 v23, v0

    add-float v18, v23, v10

    .line 105
    .local v18, labelY:F
    move v0, v14

    int-to-float v0, v0

    move/from16 v23, v0

    move-object v0, v12

    move-object v1, v6

    move/from16 v2, v23

    move/from16 v3, v16

    move-object/from16 v4, v19

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 108
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    move-object/from16 v23, v0

    const v24, 0x7f050015

    invoke-virtual/range {v23 .. v24}, Lcom/nemustech/regina/ResourceCare;->getColor(I)I

    move-result v23

    move-object/from16 v0, v19

    move/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 109
    sget-object v23, Landroid/graphics/Typeface;->DEFAULT:Landroid/graphics/Typeface;

    move-object/from16 v0, v19

    move-object/from16 v1, v23

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    .line 110
    invoke-virtual {v9}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v23

    move-object/from16 v0, p0

    iget v0, v0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mWidget2DWidth:I

    move/from16 v24, v0

    mul-int/lit8 v25, v14, 0x3

    sub-int v24, v24, v25

    sub-int v24, v24, v15

    move-object/from16 v0, v23

    move-object/from16 v1, v19

    move/from16 v2, v24

    invoke-static {v0, v1, v2}, Lcom/nemustech/regina/RUtils;->getEllipsisString(Ljava/lang/String;Landroid/graphics/Paint;I)Ljava/lang/String;

    move-result-object v13

    .line 112
    .local v13, eString:Ljava/lang/String;
    mul-int/lit8 v23, v14, 0x2

    add-int v23, v23, v15

    move/from16 v0, v23

    int-to-float v0, v0

    move/from16 v23, v0

    move-object v0, v12

    move-object v1, v13

    move/from16 v2, v23

    move/from16 v3, v18

    move-object/from16 v4, v19

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 124
    new-instance v5, Lcom/nemustech/regina/ElementReginaWidget$Gadget;

    new-instance v23, Landroid/graphics/Rect;

    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->left:I

    move/from16 v24, v0

    add-int/lit8 v24, v24, 0x5

    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->top:I

    move/from16 v25, v0

    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->right:I

    move/from16 v26, v0

    const/16 v27, 0x5

    sub-int v26, v26, v27

    move-object/from16 v0, p2

    iget v0, v0, Landroid/graphics/Rect;->bottom:I

    move/from16 v27, v0

    invoke-direct/range {v23 .. v27}, Landroid/graphics/Rect;-><init>(IIII)V

    const/16 v24, 0x0

    move-object v0, v5

    move-object/from16 v1, p0

    move-object/from16 v2, v23

    move-object/from16 v3, v24

    invoke-direct {v0, v1, v2, v3}, Lcom/nemustech/regina/ElementReginaWidget$Gadget;-><init>(Lcom/nemustech/regina/ElementReginaWidget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V

    .line 125
    .local v5, appForceStopGadget:Lcom/nemustech/regina/ElementReginaWidget$Gadget;
    const/16 v17, 0x0

    .line 126
    .local v17, intent:Landroid/content/Intent;
    sget v23, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v24, 0x9

    move/from16 v0, v23

    move/from16 v1, v24

    if-ge v0, v1, :cond_2

    .line 128
    new-instance v17, Landroid/content/Intent;

    .end local v17           #intent:Landroid/content/Intent;
    const-string v23, "android.intent.action.VIEW"

    move-object/from16 v0, v17

    move-object/from16 v1, v23

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 129
    .restart local v17       #intent:Landroid/content/Intent;
    const-string v23, "com.android.settings"

    const-string v24, "com.android.settings.InstalledAppDetails"

    move-object/from16 v0, v17

    move-object/from16 v1, v23

    move-object/from16 v2, v24

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->setClassName(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 130
    const-string v23, "package"

    move-object v0, v7

    iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    move-object/from16 v24, v0

    move-object/from16 v0, v17

    move-object/from16 v1, v23

    move-object/from16 v2, v24

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 131
    const-string v23, "pkg"

    move-object v0, v7

    iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    move-object/from16 v24, v0

    move-object/from16 v0, v17

    move-object/from16 v1, v23

    move-object/from16 v2, v24

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 132
    const-string v23, "com.android.settings.ApplicationPkgName"

    move-object v0, v7

    iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    move-object/from16 v24, v0

    move-object/from16 v0, v17

    move-object/from16 v1, v23

    move-object/from16 v2, v24

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 153
    :goto_1
    move-object v0, v5

    move-object/from16 v1, v17

    invoke-virtual {v0, v1}, Lcom/nemustech/regina/ElementReginaWidget$Gadget;->setIntent(Landroid/content/Intent;)V

    .line 154
    const/16 v23, 0x2

    move-object v0, v5

    move/from16 v1, v23

    invoke-virtual {v0, v1}, Lcom/nemustech/regina/ElementReginaWidget$Gadget;->setGadgetType(I)V

    .line 155
    const/16 v23, 0x0

    move-object/from16 v0, p0

    move/from16 v1, v23

    move-object v2, v5

    invoke-virtual {v0, v1, v2}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->addGadget(ILcom/nemustech/regina/ElementReginaWidget$Gadget;)V

    goto/16 :goto_0

    .line 136
    :cond_2
    new-instance v17, Landroid/content/Intent;

    .end local v17           #intent:Landroid/content/Intent;
    const-string v23, "android.settings.APPLICATION_DETAILS_SETTINGS"

    new-instance v24, Ljava/lang/StringBuilder;

    invoke-direct/range {v24 .. v24}, Ljava/lang/StringBuilder;-><init>()V

    const-string v25, "package:"

    invoke-virtual/range {v24 .. v25}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v24

    move-object v0, v7

    iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String;

    move-object/from16 v25, v0

    invoke-virtual/range {v24 .. v25}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v24

    invoke-virtual/range {v24 .. v24}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v24

    invoke-static/range {v24 .. v24}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v24

    move-object/from16 v0, v17

    move-object/from16 v1, v23

    move-object/from16 v2, v24

    invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .restart local v17       #intent:Landroid/content/Intent;
    goto :goto_1
.end method

.method protected onDrawFrontTitle(Landroid/graphics/Bitmap;Landroid/graphics/Rect;)V
    .locals 13
    .parameter "bitmap"
    .parameter "area"

    .prologue
    .line 180
    new-instance v7, Ljava/lang/StringBuffer;

    invoke-direct {v7}, Ljava/lang/StringBuffer;-><init>()V

    .line 181
    .local v7, title:Ljava/lang/StringBuffer;
    const-string v9, "App Manager - %dM free"

    const/4 v10, 0x1

    new-array v10, v10, [Ljava/lang/Object;

    const/4 v11, 0x0

    iget v12, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mFreeMem:I

    invoke-static {v12}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v12

    aput-object v12, v10, v11

    invoke-static {v9, v10}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v7, v9}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 183
    iget-object v9, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mResources:Landroid/content/res/Resources;

    const v10, 0x7f020055

    invoke-static {v9, v10}, Lcom/nemustech/regina/RUtils;->decodeResource(Landroid/content/res/Resources;I)Landroid/graphics/Bitmap;

    move-result-object v6

    .line 186
    .local v6, refreshIcon:Landroid/graphics/Bitmap;
    new-instance v2, Landroid/graphics/Canvas;

    invoke-direct {v2, p1}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    .line 187
    .local v2, canvas:Landroid/graphics/Canvas;
    new-instance v5, Landroid/graphics/Paint;

    invoke-direct {v5}, Landroid/graphics/Paint;-><init>()V

    .line 188
    .local v5, paint:Landroid/graphics/Paint;
    new-instance v1, Landroid/graphics/Rect;

    invoke-direct {v1}, Landroid/graphics/Rect;-><init>()V

    .line 189
    .local v1, bounds:Landroid/graphics/Rect;
    const/4 v9, 0x1

    invoke-virtual {v5, v9}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 190
    sget-object v9, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    invoke-virtual {v5, v9}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    .line 191
    iget-object v9, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    const v10, 0x7f060042

    invoke-virtual {v9, v10}, Lcom/nemustech/regina/ResourceCare;->getDimensionI(I)I

    move-result v9

    int-to-float v9, v9

    invoke-virtual {v5, v9}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 192
    iget-object v9, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRC:Lcom/nemustech/regina/ResourceCare;

    const v10, 0x7f050006

    invoke-virtual {v9, v10}, Lcom/nemustech/regina/ResourceCare;->getColor(I)I

    move-result v9

    invoke-virtual {v5, v9}, Landroid/graphics/Paint;->setColor(I)V

    .line 193
    const/high16 v9, 0x3f00

    const/high16 v10, 0x3f80

    const/high16 v11, 0x3f80

    const/high16 v12, -0x100

    invoke-virtual {v5, v9, v10, v11, v12}, Landroid/graphics/Paint;->setShadowLayer(FFFI)V

    .line 194
    invoke-virtual {v7}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {p2}, Landroid/graphics/Rect;->width()I

    move-result v10

    invoke-virtual {v6}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v11

    sub-int/2addr v10, v11

    invoke-static {v9, v5, v10}, Lcom/nemustech/regina/RUtils;->getEllipsisString(Ljava/lang/String;Landroid/graphics/Paint;I)Ljava/lang/String;

    move-result-object v3

    .line 195
    .local v3, ellipsisString:Ljava/lang/String;
    const/4 v9, 0x0

    invoke-virtual {v3}, Ljava/lang/String;->length()I

    move-result v10

    invoke-virtual {v5, v3, v9, v10, v1}, Landroid/graphics/Paint;->getTextBounds(Ljava/lang/String;IILandroid/graphics/Rect;)V

    .line 196
    invoke-virtual {p2}, Landroid/graphics/Rect;->height()I

    move-result v9

    invoke-virtual {v1}, Landroid/graphics/Rect;->height()I

    move-result v10

    sub-int/2addr v9, v10

    div-int/lit8 v9, v9, 0x2

    int-to-float v4, v9

    .line 197
    .local v4, offset:F
    invoke-virtual {v5}, Landroid/graphics/Paint;->ascent()F

    move-result v9

    neg-float v9, v9

    float-to-double v9, v9

    invoke-static {v9, v10}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v9

    double-to-int v0, v9

    .line 198
    .local v0, ascent:I
    iget v9, p2, Landroid/graphics/Rect;->left:I

    int-to-float v9, v9

    iget v10, p2, Landroid/graphics/Rect;->top:I

    int-to-float v10, v10

    add-float/2addr v10, v4

    int-to-float v11, v0

    add-float/2addr v10, v11

    invoke-virtual {v2, v3, v9, v10, v5}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 201
    iget v9, p2, Landroid/graphics/Rect;->right:I

    invoke-virtual {v6}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v10

    sub-int/2addr v9, v10

    int-to-float v9, v9

    invoke-virtual {p2}, Landroid/graphics/Rect;->centerY()I

    move-result v10

    invoke-virtual {v6}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v11

    div-int/lit8 v11, v11, 0x2

    sub-int/2addr v10, v11

    int-to-float v10, v10

    const/4 v11, 0x0

    invoke-virtual {v2, v6, v9, v10, v11}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 205
    new-instance v8, Lcom/nemustech/regina/ElementReginaWidget$Gadget;

    new-instance v9, Landroid/graphics/Rect;

    invoke-direct {v9, p2}, Landroid/graphics/Rect;-><init>(Landroid/graphics/Rect;)V

    const/4 v10, 0x0

    invoke-direct {v8, p0, v9, v10}, Lcom/nemustech/regina/ElementReginaWidget$Gadget;-><init>(Lcom/nemustech/regina/ElementReginaWidget;Landroid/graphics/Rect;Landroid/graphics/Rect;)V

    .line 206
    .local v8, userGadget:Lcom/nemustech/regina/ElementReginaWidget$Gadget;
    const/4 v9, 0x7

    invoke-virtual {v8, v9}, Lcom/nemustech/regina/ElementReginaWidget$Gadget;->setGadgetType(I)V

    .line 207
    const/4 v9, 0x2

    invoke-virtual {p0, v9, v8}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->addGadget(ILcom/nemustech/regina/ElementReginaWidget$Gadget;)V

    .line 208
    return-void
.end method

.method protected onResume()V
    .locals 4

    .prologue
    .line 226
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppFilter:Lcom/nemustech/regina/ReginaAppFilter;

    const/4 v1, 0x4

    const/4 v2, 0x1

    invoke-virtual {v0, v1, v2}, Lcom/nemustech/regina/ReginaAppFilter;->getInstalledApps(IZ)Ljava/util/List;

    move-result-object v0

    iput-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    .line 227
    invoke-direct {p0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->getMemoryInfo()Landroid/app/ActivityManager$MemoryInfo;

    move-result-object v0

    iget-wide v0, v0, Landroid/app/ActivityManager$MemoryInfo;->availMem:J

    const-wide/32 v2, 0x100000

    div-long/2addr v0, v2

    long-to-int v0, v0

    iput v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mFreeMem:I

    .line 228
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    if-eqz v0, :cond_0

    .line 229
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->resetPages(I)V

    .line 233
    :goto_0
    invoke-virtual {p0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->update()V

    .line 234
    return-void

    .line 231
    :cond_0
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->resetPages(I)V

    goto :goto_0
.end method

.method protected onUpdate()Z
    .locals 3

    .prologue
    .line 215
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.intent.action.MAIN"

    const/4 v2, 0x0

    invoke-direct {v0, v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V

    .line 216
    .local v0, mainIntent:Landroid/content/Intent;
    const-string v1, "android.intent.category.LAUNCHER"

    invoke-virtual {v0, v1}, Landroid/content/Intent;->addCategory(Ljava/lang/String;)Landroid/content/Intent;

    .line 217
    iget-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v0, v2}, Landroid/content/pm/PackageManager;->queryIntentActivities(Landroid/content/Intent;I)Ljava/util/List;

    move-result-object v1

    iput-object v1, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppRIList:Ljava/util/List;

    .line 218
    const/4 v1, 0x1

    return v1
.end method

.method protected onUpdateTitle()Z
    .locals 1

    .prologue
    .line 305
    const/4 v0, 0x1

    return v0
.end method

.method protected userDefActor()V
    .locals 4

    .prologue
    .line 238
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mAppFilter:Lcom/nemustech/regina/ReginaAppFilter;

    const/4 v1, 0x4

    const/4 v2, 0x1

    invoke-virtual {v0, v1, v2}, Lcom/nemustech/regina/ReginaAppFilter;->getInstalledApps(IZ)Ljava/util/List;

    move-result-object v0

    iput-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    .line 239
    invoke-direct {p0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->getMemoryInfo()Landroid/app/ActivityManager$MemoryInfo;

    move-result-object v0

    iget-wide v0, v0, Landroid/app/ActivityManager$MemoryInfo;->availMem:J

    const-wide/32 v2, 0x100000

    div-long/2addr v0, v2

    long-to-int v0, v0

    iput v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mFreeMem:I

    .line 241
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    if-eqz v0, :cond_0

    .line 242
    iget-object v0, p0, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->mRunningAppList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->resetPages(I)V

    .line 247
    :goto_0
    invoke-virtual {p0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->updateTitle()Z

    .line 248
    invoke-virtual {p0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->refreshFrontCenter()V

    .line 249
    return-void

    .line 244
    :cond_0
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/nemustech/regina/widgets/appmanager/AppManagerWidget;->resetPages(I)V

    goto :goto_0
.end method
